This code is supposed to define a function that changes the total member of the PatientAccount class using information from the Surgery class. The problem is that when I define it in the main.cpp file I get an error saying the total member PatientAccount is inaccessible. I've looked up other code and I'm doing it the same way I've seen other people do it.
Here's the code. All of this is in the main.cpp file.
The first friend declaration fails because PatientAccount has not been declared yet. It should work if you place a forward declaration of Surgery at the beginning of the code. class Surgery;