How to make a user-defined type initialize *exactly* like a built-in type?
I would like to make a type that wraps a numeric type (and provides additional functionality). Furthermore, I need the number and the wrapper to be both implicitly convertible to each other. So far I have: template<class T> struct Wrapper { T value; Wrapper() { } Wrapper(T const &value) : value(value) { } // ... operators defined here ... }; It's almost good, but it doesn't quite behave the same as a built-in type: #include <iostream> int main() { unsigned int x1, x2 = unsigned int(); Wrapper<unsigned int> y1, y2 = Wrapper<unsigned int>(); std::cerr << x1 << std::endl; // uninitialized, as