Listing 3 An example illustrating scope rules for friend functions.

int k;

class X
       {
       int i;
       static int k;
       friend void f(X &x) { x.i = ++k; }
       friend void g(X &x);
       };

void g(X &x} { x.i ++k; }
// End of File