When I want to compile the above statement, it gives "passing ‘const BC_c’ as ‘this’ argument of ‘bool BC_c::operator==(const BC_c&)’ discards qualifiers [-fpermissive]" error message.
but if I simply change to the following, the compiling goes through, got confused.
It means that this function will not change the object state, which allows it to be called on const objects.
Member functions are internally implemented as freestanding functions with implicif first parameter this. Your operator can be written as: bool BC_c@operator==(BC_c* this, const BC_c&)
Qualifiers applied to member functions, applies those modifiers to this parameter.
So bool BC_c::operator==(const BC_c&) const
Will be transformed to bool BC_c@operator==(const BC_c* this, const BC_c&)