Different Leafs from different trees in one tree


here is what I want to do:

I have:
Tree A with leaf x
Tree B with leaf x
File file1 containing tree A and B

I Want:
Tree C with leaf Ax and Bx (seperataly)
File file2 containing Tree C

Tree A and B have the same same number of events. The leaves of A and B are not necessary the same type.
The leafs Ax and Bx should be accessable like normal leafs would be.

I tried using AddFriend but this just friends the trees and so the name of the same variables should be accessed via the specific tree name.

I tried searching for this but mostly I got answers to copy using a dummy variable (this is complicated since there are different types of them) and loop over it or answers which wanted to merge the trees via TList which is just not what I want since I want the leafs seperately.

Thanks for your help.