// Build don't link: // Copyright (C) 1999 Free Software Foundation // by Alexandre Oliva template void foo(T); template void foo(T*); template class bar { private: int i; // ERROR - this variable friend void foo(T); }; template void foo(T) { bar().i = 0; // ok, I'm a friend } template void foo(T*) { bar().i = 1; // ERROR - not a friend } int main() { int j = 0; foo(j); // calls foo(int), ok foo(&j); // calls foo(int*) // ERROR - not a friend foo(&j); // calls foo(int*), ok }