Recreating a queue in C++ from scratch