using System;
public class Program
{
public static void Main()
A a = new A(0.0d);
B b = new B(0.0d);
// this will error
A result = a + b;
}
public struct A
private readonly double value;
public A(double value)
this.value = value;
// just comment it out
/*
public static A operator +(A a, B b)
throw new InvalidOperationException();
*/
public static implicit operator A(double value)
return new A(value);
public struct B
public B(double value)
public static implicit operator B(double value)
return new B(value);