Hello,
how can I overload << with templates, please?

Qt Code:
  1. template <class T = int, size_t N = 100>
  2. class Stack {
  3. T _data[N];
  4. size_t _index;
  5.  
  6. public:
  7. Stack() : _index(0) { }
  8. void push(const T& value) {
  9. if ( _index != N) _data[_index] = value;
  10. else printf("stack full\n");
  11. }
  12.  
  13.  
  14. friend std::ostream& operator<<(std::ostream& os, const Stack<T>& stack) {
  15. for (int i=0; i < N; ++i)
  16. os << _data[i] << " ";
  17. return os;
  18. }
  19. };
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. error C2597: illegal reference to non-static member 'Stack<>::_data'
  2. .....and others.....
To copy to clipboard, switch view to plain text mode