Doubly-linked list in C++