I have declared the prototype of the friend function in the class Stocks. When I call such class in main i get:
stock.cpp: In function ‘int main(int, char**)’:
stock.cpp:38: error: ‘readFile’ was not declared in this scope
I have done this before in other programs and this one just seems to hate me. I cant take that kind of rejection :(
The problem is that while the function will not be defined or declared it is invisible. So you can either to place the definition before the main or declare the function before the main. For example
well I wanted to use the prototype already in the Stocks class so I can access private member variables in my readFile() function. The commented out part was just in case I had to do a workaround.