c++ overloading operator<< and operator>>
<pre><code>class Book
{ 
     string title;
     int category;
 public:
    Book(const string&amp; abook, int num);
    string getTitle() const;
    int getCategory() const;
    friend ostream&amp; operator&lt;&lt;(ostream&amp; os, const Book&amp; abook);
    friend istream&amp; operator&gt;&gt;(istream&amp; is, Book&amp; abook);
 };

class Reader  // base class
{
private:
    string reader_name;
    vector&lt;Book&gt; bookLists;
public:
   string showname() const;
   void add(const Book&amp; abook);    // organize book list
   friend ostream&amp; operator&lt;&lt;(ostream&amp; os, const Reader&amp; read_name);
   friend istream&amp; operator&gt;&gt;(istream&amp; is, Reader&amp; read_name);
};

 class fantasyReader : public Reader {  };
 class horrorReader : public Reader { };
 class scienceReader : public Reader { } ;
class mysteryReader : public Reader { };
</code></pre>

<p>I have two given text files.<br>
1) Reader.txt &lt;--- contains reader's name and category<br><br>
For ex.<br><br>
David  &lt;- reader's name<br>
0      &lt;- david is Fantasy reader<br><br><br></p>

<p>2) Book.txt &lt;---- contains Book's title and category<br><br></p>

<p>For ex<br>
Riddick &lt;- Book's title <br>
0      &lt;- Book's category is fantasy<br>
<br><br>
In the main function, array of pointers to Reader's obj are pointing each dervied class;<br></p>

<pre><code> ex

Reader *obj[10];
int pos =0;
obj[pos++] = new fantasyReader();
</code></pre>

<p>The main goal is to organize book's list and put into a appropriate category and appropriate reader<br> and write them into a new text file.<br>
ex.<br><br>
-David-<br>
Riddick<br>
<br>
-John-<br>
The Crow<br></p>

<p><br><br></p>

<p>MY QUESTION<br>
I'm not sure what should be inside of operator&lt;&lt; and operator>><br>
for class Book and class Reader<br></p>
