overloaded extration operator without namespace std
Just wondering if anyone could point me in the right direction. I have a friend extraction operator that works if i include namespace std; but fails if i do not. can anyone give me a hint?
ostream& operator << (ostream &out, coins &value)
this is also a friend function, so i have this in my class.h file (as a friend)
in my functions.h file (as the prototype) and in my functions.cpp file (the logic).
ive tried making it
std::ostream& operator std::<< (etc)
but i just cant see where im going wrong. My compiler keeps telling me 'ostream does not name a type'
using namespace std;
your declaration should be:
friend std::ostream& operator << (std::ostream &out, coins &value) ;
Hey man, thanks a lot. This is exactly what i needed.
Topic archived. No new replies allowed.