Simple stack implementation in c++