540. Where a taxpayer disposes of capital property that is a share of the capital stock of a foreign affiliate of the taxpayer to a corporation that, immediately after the disposition, is also a foreign affiliate of the taxpayer, for consideration that includes a share of the capital stock of that affiliate:(a) section 542 applies, with the necessary modifications, to determine the cost to the taxpayer of all property receivable by him as consideration for such disposition;
(b) the taxpayer’s proceeds of such disposition of the shares so disposed of is deemed to be equal to the aggregate of the cost to him of all property receivable by him as consideration; and
(c) the cost to the foreign affiliate of the shares acquired by it from the taxpayer is deemed to be equal to the taxpayer’s proceeds of disposition of them, as determined in paragraph b.