(5) Affiliated group For purposes of this subsection— (A) In general Except as provided in subparagraph (B), the term “affiliated group” has the meaning given such term by section 1504. Notwithstanding the preceding sentence, a foreign corporation shall be treated as a member of the affiliated group if— (i) more than 50 percent of the gross income of such foreign corporation for the taxable year is effectively connected with the conduct of a trade or business within the United States, and (ii) at least 80 percent of either the vote or value of all outstanding stock of such foreign corporation is owned directly or indirectly by members of the affiliated group (determined with regard to this sentence). (B) Treatment of certain financial institutions For purposes of subparagraph (A), any corporation described in subparagraph (C) shall be treated as an includible corporation for purposes of section 1504 only for purposes of applying such section separately to corporations so described. This subparagraph shall not apply for purposes of paragraph (6). (C) Description A corporation is described in this subparagraph if— (i) such corporation is a financial institution described in section 581 or 591, (ii) the business of such financial institution is predominantly with persons other than related persons (within the meaning of subsection (d)(4)) or their customers, and (iii) such financial institution is required by State or Federal law to be operated separately from any other entity which is not such an institution. (D) Treatment of bank holding companies To the extent provided in regulations— (i) a bank holding company (within the meaning of section 2(a) of the Bank Holding Company Act of 1956), and (ii) any subsidiary of a financial institution described in section 581 or 591 or of any bank holding company if such subsidiary is predominantly engaged (directly or indirectly) in the active conduct of a banking, financing, or similar business, shall be treated as a corporation described in subparagraph (C).