You're trying to call ostringstream::operator<<
with the argument being a Course
. You need to define operator<<
for Course
as well. Sorry I missed this before. You should also remove the friend
from the definition of operator<<(ostream&, const University&)
though since it's only needed inside the class definition.
manpreet
Best Answer
2 years ago
I am writing a small program in C++. There is a class. Can you use cout in the class to output data. Such as cout << "Good times"; Don't you need then to overload << operator? I am trying to do that but it does not work only some errors. How to output data via cout having it in the class.
CPP file: