Why do we get an error when compiling the following code ?
class Pokemon {
int hp;
Pokemon(int _hp) : hp(_hp) {}
public:
void drain(Pokemon other) {
other.hp -= 2; hp += 2;
}
};
int main() {
Pokemon p1; Pokemon p2;
p1.drain(p2);
}