help with templates
<p>Can someone pls tell me whats wrong with my code. Im guessing that I didnt overload &lt;&lt; correctly but im not sure how to fix it.</p>

<p>The below code implements a simple Stack container. It fails at cout &lt;&lt; si;</p>

<p>update: Made suggested changes, still not compiling.</p>

<p>update2: got it! thx</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

template &lt;typename T = int, int N = 10&gt;
struct Stack
{
    T elems[N];
    unsigned int size;

    Stack()
    {
        size=0;
    }

    void push(T e)
    {
        elems[size]=e;
        size++;
    }

    T pop()
    {
        size--;
        return elems[size];
    }

            template &lt;typename T, int N&gt;
    friend ostream&amp; operator &lt;&lt; (ostream&amp; os, const Stack&lt;T, N&gt; &amp;stack);
};

template &lt;typename T, int N&gt;
ostream&amp; operator &lt;&lt; (ostream&amp; os, const Stack&lt;T, N&gt; &amp;stack)
{
    for (unsigned int i=0; i&lt;N; i++)
    {
        os &lt;&lt; stack.elems[i];
    }

    return os;
}


int main()
{   

    Stack&lt;&gt; si;
    si.push(3);
    cout &lt;&lt; si;

}
</code></pre>
