This is the code from the C++ standard library remove code. Why is inequality tested as if (!(*first == val)) instead of if (*first != val)
Most functions in STL work only with operator< or operator==. This requires the user only to implement these two operators (or sometimes at least one of them). For example std::set uses operator< (more precisely std::less which invokes operator< by default) and not operator> to manage ordering. The remove template in your example is a similar case - it uses only operator== and not operator!= so the operator!= doesn't need to be defined.