In general
Notwithstanding subsection (c)(1)(B), (c)(4), or (d)(1)(C), if—
(A) a child receives over one-half of the child’s support during the calendar year from the child’s parents— (i) who are divorced or legally separated under a decree of divorce or separate maintenance, (ii) who are separated under a written separation agreement, or (iii) who live apart at all times during the last 6 months of the calendar year, and—
(B) such child is in the custody of 1 or both of the child’s parents for more than one-half of the calendar year, such child shall be treated as being the qualifying child or qualifying relative of the noncustodial parent for a calendar year if the requirements described in paragraph (2) or (3) are met.