Can I create a class/enum/typedef that behaves just like a number but also has members/overloaded implicit conversion?

I have a class called Base, which is basically just a double with a bunch of member functions and a long list of operators to make it behave like a number. Other than that, I also have a Type() member which returns an integer.

I want to keep the Base type because it makes my code more readable and distinguishes the base type from an ordinary double, but I also don't like having to overload every single operators, as this is tedious. Ideally, I'd use enum Base double and then declare a Base member function Type() to get the integer, but this isn't legal in c++, is it?

So how can I easily achieve double-like functionality of my class while having a simple member function that returns an int?

P.S. the Type() function is not a simple cast or rounding, it's a complex function that I'd like to keep as a member if possible for clarity.

Right, but you may not need one. Do you have an example of one you think you need?

Well as the class stores a double, I was thinking of simply typedefing something like this:

typedefdouble Base

and then creating a custom global function:

int getType(Base&);

which returns the type value based on the input. However, I am trying to avoid situations where I have global functions that only operate on a single type. Since a typedef member function isn't possible, can I overload implicit conversion, so that I could then do this:

So does the compiler know to cast to reference to double in "A" because it sees that a) there is no "+=" for the real class, b) there is a "+=" operator for the double primitive and c) the real class can implicit cast to double?

You should not be having conversion operators for any other standard arithmetic type other than double; an implicit conversion from, say, real => int would be still possible, since a user defined conversion and a standard conversion can be combined.