Question: If I manually overload the `==` operator for a structure, do I get the `!=` operator for free (presumably defined to be the boolean opposite), or do I have to overload it manually (even if to just `return !(this == rhs)`?

Edit-The question is not whether or not I CAN overload both operators, but whether I must overload inequality if I've already overloaded the equality operator. Regardless, good answers have been given.

Answer: 
Overloading `operator ==` does not give you `operator !=`. You have to do it manually and the canonical way is to implement it in terms of `operator ==` as in `!(left == right)`.

The semantics of the operators are not dictated by the standard. You could very well overload `operator ==` to mean equality yet overload `operator !=` to something different like addition or even equality again *(not that this is a good practice, in fact it should be discouraged. When in doubt, do as the ints do...)*.[Refer (1) Below]

On a side note, `Boost.Operators` can help you provide canonical implementations for operators. There is also `std::rel_ops` with a canonical implementation for `operator !=`.

(1) To know more about it read **[Three basic rules of operator overloading in C++.](https://stackoverflow.com/questions/4421706/operator-overloading/4421708#4421708)**
It doesn't, and thankfully it is the way it is. For example, you might want a structure, where both a!=b and a==a are true. They are not necessary the inverse, they can be anything you want.

Boosts the creativity. :)

For example if you don't know the result of a comparison, or it is generally not known, then it would be reasonable to a==b and a!=b return the same.

Example: <http://en.wikipedia.org/wiki/Three-valued_logic>