For purposes of subparagraph (B) of paragraph (1), stock owned, directly or indirectly, by or for a foreign corporation, foreign partnership, or foreign trust or foreign estate (within the meaning of section
7701
(a)(31)) shall be considered as being owned proportionately by its shareholders, partners, or beneficiaries. Stock considered to be owned by a person by reason of the application of the preceding sentence shall, for purposes of applying such sentence, be treated as actually owned by such person.