Tchain with friends

I would like to do this

  TChain *chainele = new TChain("my_tree_name");

  chainele->Add("file1.root");
  TFile * f = new TFile("file1.root","file1.root");
  chainele->AddFriend("my_tree_name_2",f);

  chainele->Add("file2.root");
  f = new TFile("file2.root","file2.root");
  chainele->AddFriend("my_tree_name_2",f);

But this doesn’t work. When I try to access a variable in the friend tree, it only works for file1.root.

Is there anyway to make a TChain which has friends?

I found one way to do it. Make another chain for the friend tree and add the files in the same order. Then make that chain a friend of the first one.