C++ operator overloading for rationalNumber
Style:


Use an initialiser list for constructors, with meaningful parameter names. example at the end.
Please use the right type for negative - true/false makes it a lot easier to read and understand inline what type negative is.
Naming: The toString() is easier expressed by returning a std::string - that can be used as-is or forwarded to std::cout or other logs. If you want to use a log output, (e.g. std::cout) it can be trivially implemented using a template operator&lt;&lt; with a generic ostream input - in this case it is not required (see below)
The operator+ can be expressed in a single line, without the temporary added variable.
it is desirable to make gcd an non-member file-local static function (static gcd(int a, int b)) the rationale being that the logic:


doesn't depend on the state (or const-ness) of the Rational object (so non-member)
doesn't need to access the (private/protected) innards of Rational(so non-static, non-friend)

In main, the for loop can be shortened (in general, if a function call chain helps avoid a temp variable, do so). example at the end.


The same logic (avoiding a temp variable) holds for defining r3 and r4 inlined when adding them to the map. 


vector v is unused.
Include what you use: vector, map, iostream, cmath (and iterator if you decide to use ostream_iterator.
maps don't require an input iterator during insertion. Use std::make_pair(a, b) to cut down on the verbose template boilerplate.


Logical Issues:


Translation into abs and negative is done in the ctor and not followed up well in other places. This will fail for negative test cases. hint: why is negative required as a member?
adding 1/4 and 1/2 results in 6/8 - while this isn't incorrect, this defeats the purpose. Invoke gcd there.
Depending on how you want your object to behave, handle the case of (den == 0), either by explicity asserting against its occurence, or by adding special handling for arithmetic operators. You don't want a 1/0 + 5/2 == 2/0 comparison.


Constructor style preferred:

RationalNumber() : num(1), den(1), negative(false) {}
RationalNumber(int numerator, int denominator) 
: num(abs(numerator))
, den(abs(denominator))
, negative((numerator &lt; 0) == (denominator &lt; 0)) 
{
    //use gcd here
}


Terser loop style suggestions:

for (map&lt;RationalNumber, string&gt;::iterator it = S.begin(); it != S.end();++it) 
{
    std::cout &lt;&lt; "comparing:" &lt;&lt; itr-&gt;first.toString() &lt;&lt; itr-&gt;second &lt;&lt; std::endl;
}


or the even terser lambda:

transform(S.begin(), S.end(), ostream_iterator&lt;string&gt;(cout, '\n'), 
    [] (const pair&lt;RationalNumber, string&gt;&amp; p) { return p.first.toString() + " " + p.second; });


edits: 
Moved code examples to the end - as code indents don't work in between bulleted points.