Inside the node class, you declare a friend function int add (int, int). However, the compiler has not yet come across this function, and therefore it is unknown.
You can create a separate header and source file for the add function. Then in node.h there is a new header. Since in the file where you are declaring node, the add function is not currently known.
So you can do add.h and the add.cpp file, for example, and add add.h before the node declaration. Remember to compile add.cpp as well.
source share