Quote:
The thing is, though, when the Rational class is templated, the compiler can no longer figure out how to convert EITHER argument because it can't figure out what type to make the second operand. If it's defined in the class, it at least knows what type, and if it's a friend, you can do int * Rational again.
Friendship has nothing to do with what you appear to be describing. Either way, this argument isn't really a good counterpoint to Meyers' suggestion. It's failing not because of a problem with the fact that the operator is free, but because the class is ambiguous -- it has implicit conversions.
Implicit conversions (in the form of cast operators, or single-argument constructors not declared explicit) are generally considered bad, or at least dangerous, practice, because the nature of nearly all languages causes such conversions to produce an alarming number of ambiguities in name resolution. The end result is that one originally believed to be an ease-of-use optimization results in clutter and headache because of the different ways ambiguities can (or cannot) be resolved in different scenarios.
It seems like you're saying "let's not give a soldier a gun because he can shoot himself instead of the bad guys."
Quote:
The reason I can't use this for the specific is there's no way I can think of to make it so my constructor can logically accept only one variable, thus, the compiler wouldn't know how to do the conversions.
Your explanation is somewhat vague, but it strikes me that the 'explicit' keyword is what you're looking for. It prevents a single-argument constructor from being used as a conversion unless you explicit call it, e.g., T(value).