Programming |  C++ Programming |  class friends

A function or class can be declared as a friend of a class. This gives the friend function or class access to the private data and methods of the class:

    class class1 {
        stuff...
        friend int friend_function(int x);
        friend class friend_class;
    }

This means the friend function must be defined before the class it is to be a friend of(?).