Calling of the Destructor. And input output overloading
<p>So, the destructor is called twice if my object isn't passed by the reference.
But when i pass it by reference everything is ok.</p>

<pre><code>&lt;!-- language: lang-cpp --&gt;

ostream&amp; operator&lt;&lt;(ostream&amp; os,Counter_naslednik_1 &amp;object){
 cout&lt;&lt;endl&lt;&lt;object.date&lt;&lt;endl;
 return os;
 }

//-----------------
void main(){
Counter_naslednik_1 new_object;
cout&lt;&lt;new_object;
}
</code></pre>

<p>Why is the destructor called twice? And why should I pass my object by reference when passing it as a parameter to an overloaded operator?</p>
