Define a template function as shown below:
template IsEqual(const Obj & obj1, const Obj & obj2){ return !(memcmp ( &(obj1),&(obj2),sizeof (Obj)));}
It will be used as follows.
Obj a;Obj b;if (IsEqual(a,b)){ //objects are equal}
This will make the code more readable and typesafe.