Loan to be repaid on death of spouse

I am representing an executor where the testator loaned a large sum of money to one of his children and made provisions in his Letter for Wishes for the loan to be repaid on the date of her wife’s death. Can this be done?
Also, does the loan count towards the estate for IHT purposes even if it has not been repaid?
By deducting this loan from the child’s residual gift, does that result in less inheritance tax to pay?
I am asking because the client is seeking a way to avoid paying a large amount of IHT on that money and I am struggling to see how that is possible.
Has anyone had a similar situation and what did you do?

It seems pretty straightforward. It is an asset of the estate so subject to inheritance tax. It doesn’t matter what happens following the death (the debt anti-avoidance provisions only apply to loans where the deceased is the debtor, not the creditor).

Sounds as though setting the debt off against the child’s share would be the simplest and most sensible solution from a distribution perspective. It makes no sense to distribute money only to demand it be repaid.

Thank you Andrew. I agree with you on the course of action.