I have an enum, but I want to have an assignment operator for it to be able to assign a type that is not of the original enum. E.g.
enum class X : int
{
A, B, C, D
}
enum class Y : char
{
A, B, C, D
}
Y& operator=(Y& lhs, X rhs)
{
return Y = static_cast<Y>(X);
}
But I'm getting an 'operator =' must be a non-static member
. Is there no way to do this?