Equality test with generic type