(b) Whenever it appears upon any settlement of accounts or in any other appropriate action or proceeding, that an executor, administrator, curator, trustee or other person acting in a fiduciary capacity, has paid an estate tax levied or assessed under the provisions of any estate tax law of the United States or this state heretofore or hereafter enacted, upon or with respect to any property required to be included in the gross estate of a decedent under the provisions of any such law, the amount of the tax so paid shall be prorated among the persons interested in the estate to whom such property is or may be transferred or to whom any benefit accrues. Such apportionment shall be made in the proportion that the value of the property, interest or benefit of each such person bears to the total value of the property, interests and benefits received by all such persons interested in the estate, except that in making such proration each such person shall have the benefit of any exemptions, deductions and exclusions allowed by such law in respect of such person or the property passing to him; and except that notwithstanding the preceding provisions of this sentence in cases where a trust is created, or other provision made whereby any person is given an interest in income, or an estate for years, or for life, or other temporary interest in any property or fund, the tax on both such temporary interest and on the remainder thereafter shall be charged against and paid out of the corpus of such property or fund without apportionment between remainders and temporary estates.
(c) In all cases in which any property required to be included in the gross estate does not come into the possession of the executor, administrator or other fiduciary as such, he shall be entitled, and it shall be his duty, to recover from whomever is in possession, or from the persons interested in the estate, the proportionate amount of such tax payable by the persons interested in the estate with which such persons interested in the estate are chargeable under the provisions of this section.
(d) No executor, administrator or other person acting in a fiduciary capacity shall be required to transfer, pay over or distribute any fund or property with respect to which a federal or West Virginia estate tax is imposed until the amount of such tax or taxes, due from the devisee, legatee, distributee or other person to whom such property is transferred, is paid to such fiduciary, or, if the apportionment of tax has not been determined, adequate security is furnished by the transferee for such payment.
(e) But it is expressly provided that the foregoing provisions of this section are subject to the following qualification, that none of such provisions shall in any way impair the right or power of any person by will or by written instrument executed inter vivos to make direction for the payment of such estate taxes, and to designate the fund or funds or property out of which such payment shall be made, and in every such case the provisions of the will or of such written instrument executed inter vivos shall be given effect to the same extent as if this section had not been enacted.
(f) The provisions of this section shall be applicable to estates of decedents dying after the enactment of this section.