Doubly Linked list implementation in CPP