Where you wrote ostream &Month::operator<<(ostream &strm, const Month &obj) , you should be writing ostream &operator<<(ostream &strm, const Month &obj) . The function you're defining is not declared as a member function of the Month class.