Show how to overload the operators << and >> to create stream output for this class. Make these functions friends of the class Pair. The expected form of a pair is (2,3) for both input and output. To make this problem manageable, you should only provide to accept and discard the parentheses and comma, but you should not check that these particular characters were typed. Output should be the expected form.
```
class IntPair
{
int first;
int second;
public:
IntPair(int firstValue, int secondValue);
int getFirst( ) const; int getSecond( ) const;};
```
What will be an ideal response?
```
#include
using namespace std;//Class with friend declarations:
class IntPair{ int first;
int second;
public:
IntPair(int firstValue, int secondValue);
friend int operator>>(int,IntPair);
friend istream& operator>>(istream& intStr,
IntPair& pair);
friend ostream& operator<<(ostream& outStr,
const IntPair& pair);
int getFirst( ) const; int getSecond( ) const;}; //Definitions
istream& operator>>(istream& inStr,IntPair& pair)
{
// only vestigial checking. Expect the form (1,2)
char ignore; // for ( , and ). inStr >> ignore >>
pair.first >> ignore >> pair.second
>> ignore;
return inStr;
}
ostream& operator<<(ostream& outStr,const IntPair& pair)
{outStr << "(" << pair.first << ", "
<< pair.second << '', ''
return outStr;
```