Operator != is not defined for TopologyTree, the code does not compile. I would add something like this: inline bool operator!=(TopologyTree const& t1, TopologyTree const& t2) { return !(t1 == t2); }