// Implement a generic stack class using templates.


#include <iostream.h>
#include <string.h>


template<class T>
class stack {

    public:

    friend ostream & operator<<(ostream &os, const stack &s);

    private:

    T *base;
    T *top;
    size_t size;

};


template<class T>
ostream & stack<T>::operator<<(ostream &os, const stack<T> &s) {
    for (T *ptr = s.top ; ptr >= s.base ; ptr--) {
        os << *ptr << endl;
    }
    return os;
}
