I believe Co A can settle the shares of Co B as andrew.goodman states, but that the settlor, indirectly, would be Mr X., but keep in mind Paul Saunders’ caveat re Articles
HMRC explanations on this state…
In general- trusts set up by companies (e.g pension trusts and employee benefit trusts) tend to be commercial and devoid of bounty (TSEM4110). However, this is not always the case and it is not unknown for companies to be party to the setting up of trusts that are non-commercial and involve an element of bounty. In some such cases the trust may be part of a tax avoidance scheme.
The settlements legislation may however apply to arrangements involving companies - for example where the property settled into a trust is provided by a company but the funds have been provided indirectly by the shareholder/director of that company making that individual a settlor under the extended definition at section ITTOIA/S620(3)
A person is, in particular, treated as having made a settlement if the person—
(a)has provided funds directly or indirectly for the purpose of the settlement,
(b)has undertaken to provide funds directly or indirectly for the purpose of the settlement, or
(c ) has made a reciprocal arrangement with another person for the other person to make or enter into the settlement.
It appears X would be gifting co B shares and liable for all tax consequences. May be complicated if X retains an interest in Co B shares, eg a right to dividends etc.