CS202   7- ‹#›
Nesting Example
n#include "employee.h"
nclass tree {    //binary tree class
n  public:
n    class node; //forward reference to node
n    tree();                        //default constructor
n    tree(const tree &);            //copy constructor
n    ~tree();                       //destructor
n    tree & operator = (const tree &); //assignment op
n    void insert(const employee &); //insert employee
n    void write() const;            //write employee info
n  private:
n    node* root;                    //root node of tree
n    friend static void copy(node* &, const node*);
n    friend static void destroy(node*);
n    friend static tree::node* add(node*, node*);
n};
•Notice that the friend declarations must occur after node is declared to be a private class of tree. Also notice that the definition must still qualify node as tree::node.