You understand that it don't have that problem when you put it in an implementation file.
The C++ compiler does not have any notion of headers and implementation files. It merely knows of "translation units", the cpp files. The header files are included by the C preprocessor. The compiler only sees a single file. If you define a function in a header which is included by several cpp files, and that function has external linkage, then the linker will complain about duplicate definitions.
Generally, you should only keep in headers definitions for inline functions.
If you still want to do it you have to avoid external linkage, either by declaring the function inline, or by declaring it static, or by declaring it inside a namespace without a name (which is the C++ way of defining stuff internally to a translation unit).
namespace // local
{
bool operator==(mapPoint const& p1, mapPoint const& p2)
{ return p1.x == p2.x && p1.y == p2.y; }
}
or, a bit ugly and C-ish:
static bool operator==(mapPoint const& p1, mapPoint const& p2)
{ return p1.x == p2.x && p1.y == p2.y; }
or, because this function looks like a good candidate for inlining:
inline bool operator==(mapPoint const& p1, mapPoint const& p2)
{ return p1.x == p2.x && p1.y == p2.y; }