// { dg-do compile } // Copyright (C) 2004 Free Software Foundation // Contributed by Kriang Lerdsuwanakij // Nested class of class template as friend template struct A { struct B { void f(); }; }; template class C { int i; template friend struct A::B; }; template struct A { struct B { void f(); }; }; template<> struct A { struct B { void f(); }; }; template void A::B::f() { C c; c.i = 0; } template void A::B::f() { C c; c.i = 0; } void A::B::f() { C c; c.i = 0; } int main() { A::B b1; b1.f(); A::B b2; b2.f(); A::B b3; b3.f(); }