Id guess its only working the way you are doing it because you arnt using the == operator, and so it isnt being instantiated.
You do need the export keyword to make your method work, but export isnt implemented in most compilers, and so you cant do it this way. Im sure your book explains why.
In short, when you use the operator==, the compiler needs to know the definition of the operator, and it also needs to instantiate the operator for the parameters your using it with, this cant be done when you place the definition in a seperate .cpp file, because the definition is compiled seperatly from the .cpp that your using it in, and so the correct definition cannot be instantiated. The compiler will leave a call to the linker instructing it to link the function called operator == with the parameter types your using, but the linker ont be able to find it, because it hasnt been instantiated, and so you will get a linker error
One solution is to #include"the .cpp file" at the BOTTOM of your header file.