I'm solving an exercise in which I have to implement a string queue using classes. I have the classes StringQueue, that is the actual queue, and QueueElement. The StringQueue object points to the first QueueElement, and each QueueElement holds a string and a pointer to the next QueueElement, so the whole queue is a chain of QueueElement objects with a StringQueue object in the beginning.
The function `std::string StringQueue::dequeue()` returns the first queue element. Now I have to implement the >> operator, so that `string s; queue >> s;` is the same as `string s = queue.dequeue();`. I've already managed to make this work using pointers with this function: