struct MakeFlags
{
template <class T>
friend T operator |(T a, T b) { return (T) ((int) a | (int) b); }
template <class T>
friend T operator &(T a, T b) { return (T) ((int) a & (int) b); }
};
struct Flags : MakeFlags {
enum T { Flag1 = 1, Flag2 = 2, Flag3 = 4 };
};
int main()
{
Flags::T test = Flags::Flag1 | Flags::Flag2;
return 0;
}
c3RydWN0IE1ha2VGbGFncwp7CiAgICB0ZW1wbGF0ZSA8Y2xhc3MgVD4KICAgIGZyaWVuZCBUIG9wZXJhdG9yIHwoVCBhLCBUIGIpIHsgcmV0dXJuIChUKSAoKGludCkgYSB8IChpbnQpIGIpOyB9CiAgICB0ZW1wbGF0ZSA8Y2xhc3MgVD4KICAgIGZyaWVuZCBUIG9wZXJhdG9yICYoVCBhLCBUIGIpIHsgcmV0dXJuIChUKSAoKGludCkgYSAmIChpbnQpIGIpOyB9Cn07CgpzdHJ1Y3QgRmxhZ3MgOiBNYWtlRmxhZ3MgewogICAgZW51bSBUIHsgRmxhZzEgPSAxLCBGbGFnMiA9IDIsIEZsYWczID0gNCB9Owp9OwoKaW50IG1haW4oKQp7CiAgICBGbGFnczo6VCB0ZXN0ID0gRmxhZ3M6OkZsYWcxIHwgRmxhZ3M6OkZsYWcyOwogICAgcmV0dXJuIDA7Cn0=