virtual bool operator==(const Node* other) const { if (this == other) return true; const EuclideanNode* enode = dynamic_cast(other); if (!enode) return false; return enode->x == x && enode->y == y && enode->z == z; }