added compare member function, updated comparison operators as non-member functions using compare function