Fixed operator== and operator!= in Python

It turns out SWIG cannot easily wrap free functions
operator== and operator!=, so make them member functions.