// PR c++/112288 // { dg-do link } template struct A; template struct B; A* a; B* b; template struct B { template friend int f(A*, B*, U); }; template struct B; // f declared int n = f(a, b, 0); // f specialized template struct A { template friend int f(A*, B*, U) { return 42; } }; template struct A; // f defined, need to make existing f point to defn int m = f(a, b, 0); // reuses existing specialization f int main() { }