Friend Function in Multiple Classes (OOP with C++)
Hi! I just want to learn friend function syntax in multiple classes, properly. According to what I've learned from the online courses, first of all we should define friend function to each classes in which we want to use it. When we do that, we write (for example) 'friend void functionname (classname1, classname2);'. But when I write this comment line I get an error in different compilers. So, because of that, compiler cannot run the program but even the error, codelite (one of the IDE) can run the program. In addition, when I change comment line as 'friend void functionname (classname_whichclass_I_am_in); problem solves, program runs without any error in every compiler. But I google the syntax of friend function and the true defining of ff is the first one which gives me errors. May you help me to figure out? The error I get: Unknown type name 'classname2' My complete program: https://code.sololearn.com/c4EXMSVMQMa0/?ref=app