implement compare using guard