I have a class named 'Card' and a class named 'CardDeck', with the following promotion defined in 'CardDeck.h':
CardDeck(Card card){cards.push_back(card);}
CardDeck has a friend operator+:
friend CardDeck operator+(const CardDeck, const CardDeck);
which works just fine for:
CardDeck+CardDeck
CardDeck+Card
Card+CardDeck
but it won't work for Card+Card. I get:
"no match for 'operator+' (operand types are 'Card' and 'Card')"
Why aren't the Cards being promoted to CardDecks in that case? I also tried overriding operator+ with:
friend CardDeck operator+(const Card, const Card);
but that doesn't work either. any hint why?
Thanks!