title: Trouble with overloading operator '=='. Needs to be able to handle a string, double and Date using templates
body: <p>I have a template function that handles a variable called <strong>search</strong> that can be of type <strong>string, double or date</strong>. </p>
  
  <p>The overloaded operator is used to check if an instance of the class TransactionList (a list of each bank transaction for that account) is the same as the search eg. for amount, title or date of the given transaction.</p>
  
  <p>A switch is used to dictate which option has been taken and passed through the search variable.</p>
  
  <p>The search variable arrives but only works for amount atm. How would I be able to incorporate all three datatypes into either the templated function or the overloaded operator?</p>
  
  <p>The use of getAmount(), getTitle() and getDate() are required.</p>
  
  <p><strong>Template procedure</strong></p>
  
  <pre><code>template &lt;typename T&gt;
  TransactionList TransactionList::getTransactionsForSearch(T search) const
  {
  TransactionList tempTrList(*this);
  TransactionList trlAmount;
  while (tempTrList.size() &gt; 0 )
  {
      if(search == tempTrList.newestTransaction().getAmount())
                      /* commented out attempt
          ||search == tempTrList.newestTransaction().getTitle()
          ||search == tempTrList.newestTransaction().getDate()
                      */
          trlAmount.addNewTransaction(tempTrList.newestTransaction());
      tempTrList.deleteFirstTransaction();
  }
  
  return trlAmount;
  }
  </code></pre>
  
  <p><strong>Overloaded operator</strong></p>
  
  <pre><code>template&lt;typename T&gt;
  bool TransactionList::operator==(const T&amp; var ) 
  {
  return (var == tempTrList.newestTransaction().getAmount());
              /*commented out attempt
      ||var == listOfTransactions_.newestTransaction().getDate()
      ||var == listOfTransactions_.newestTransaction().getTitle());
              */
  }   
  </code></pre>