1// { dg-do compile } 2 3// Origin: Giovanni Bajo <giovannibajo@libero.it> 4 5// PR c++/4403: Incorrect friend class chosen during instantiation. 6 7template <typename T> 8struct A 9{ 10 struct F; 11}; 12 13template <typename T> 14struct B : A<T> 15{ 16 friend struct F; 17private: 18 int priv; 19}; 20 21struct F 22{ 23 void func(void) 24 { 25 B<int> b; 26 b.priv = 0; 27 } 28}; 29