TChain, AddFriend and SetBranchAddress don't play nice together?

Update/correction:
I tried again on another laptop and did not work (already deleted your files from the previous one), but then remembered that I had also added a GetEntries() before setting the branch addresses (probably at any point before the first GetEntry works) and indeed, it works this way:

 {
  TChain sel("sel");
  TChain T("T");
  sel.Add("Qlow1_000XXXXX_nu_v9.0.root");
  T.Add("Qlow1_000XXXXX_nu_v9.0.root");
  sel.Add("bestQ_000XXXXX_nu_v9.0.root");
  T.Add("bestQ_000XXXXX_nu_v9.0.root");
  sel.AddFriend(&T);
  cout << "Number of entries: " << sel.GetEntries() << endl;
  Float_t muonscore; //This var is in sel
  Int_t n_gen; //This var is in T
  sel.SetBranchAddress("muonscore", &muonscore);
  //sel.SetBranchAddress("n_gen", &n_gen);
  sel.SetBranchAddress("sum_mc_evt.n_gen", &n_gen);
  sel.GetEntry(0);
  cout << "muonscore(0): " << muonscore << ", n_gen(0): " << n_gen << endl;
  sel.GetEntry(100);
  cout << "muonscore(100): " << muonscore << ", n_gen(100): " << n_gen << endl;
  sel.GetEntry(0);
  cout << "muonscore(0): " << muonscore << ", n_gen(0): " << n_gen << endl;

}

even with the original sel.SetBranchAddress("n_gen", &n_gen);; in both cases I get:

root [0] .x a.C
Number of entries: Warning in <TClass::Init>: no dictionary for class Evt is available
Warning in <TClass::Init>: no dictionary for class AAObject is available
Warning in <TClass::Init>: no dictionary for class Hit is available
Warning in <TClass::Init>: no dictionary for class Vec is available
Warning in <TClass::Init>: no dictionary for class Trk is available
Warning in <TClass::Init>: no dictionary for class MC_trks_summary is available
Warning in <TClass::Init>: no dictionary for class hits_summary is available
Warning in <TClass::Init>: no dictionary for class nu_summary is available
Warning in <TClass::Init>: no dictionary for class MC_evts_summary is available
Warning in <TClass::Init>: no dictionary for class Celestial_coordinates is available
Warning in <TClass::Init>: no dictionary for class crkv_hits is available
Warning in <TClass::Init>: no dictionary for class ORCA_Neutrino2020 is available
Warning in <TClass::Init>: no dictionary for class rec_trks_summary is available
Warning in <TClass::Init>: no dictionary for class jppshower_summary is available
395824
muonscore(0): 0.000750723, n_gen(0): 648
muonscore(100): 0.0123782, n_gen(100): 22100
muonscore(0): 0.000750723, n_gen(0): 648
root [1] 

Anyway, you should address the warnings too. Maybe generate a skeleton to avoid issues.