// { dg-do compile } // Origin: Giovanni Bajo // PR c++/4403: Incorrect friend class chosen during instantiation. template struct A { struct F; }; template struct B : A { friend struct F; private: int priv; }; struct F { void func(void) { B b; b.priv = 0; } };