// PR c++/59956 template struct A; template class B { int i; template friend void A::impl(); }; B<0> b1; templatestruct A { void impl(); }; B<1> b2; template void A::impl() { ++b1.i; ++b2.i; } int main() { A<0>().impl(); }