Language: C++

#include <iostream>
#include <string>

using namespace std;

template<typename T>
class DoublyLinkedList {
private:
    class Node {
    public:
        T val;
        Node *prev;
        Node *next;

        Node(T val, Node *prev, Node *next) : val(val), prev(prev), next(next) {}
    };

    Node *head;
    Node *tail:

public:
    DoublyLinkedList() {
        head = NULL;
        tail = NULL;
    }

    void insert_node(T x) {
        if (head == NULL) {
            head = new Node(x, NULL, NULL);
            tail = head;
        } else {
            head = new Node(x, NULL, head);
            head->next->prev = head;
        }

        return;
    }

    void delete_node(T x) {
        if (head == NULL) return;

        if (head->val == x) {
            Node *head_old = head;
            if (head_old->next == NULL) {
                head = NULL;
                tail = NULL;
            } else {
                head = head->next;
                head->prev = NULL;
            }
            delete head_old;
            return;
        }

        Node *node = head->next;
        while (true) {
            if (node->val == x) {
                node->prev->next = node->next;
                if (node->next == NULL) {
                    tail = node->prev;
                } else {
                    node->next->prev = node->prev;
                }
                delete node;
                break;
            }

            if (node->next != NULL) {
                node = node->next;
            } else {
                break;
            }
        }

        return;
    }

    void delete_first() {
        if (head != NULL) {
            delete_node(head->val);
        }

        return;
    }

    void delete_last() {
        if (head == NULL) return;

        if (head->next == NULL) {
            delete head;
            head = NULL;
            return;
        }

        Node *tail_old = tail;
        tail_old->prev->next = NULL;
        tail = tail_old->prev;
        delete tail_old;

        return;
    }

    void print() {
        if (head == NULL) return;
        Node *node = head;
        while (node->next != NULL) {
            cout << node->val << " ";
            node = node->next;
        }
        cout << node->val << endl;

        return;
    }
};

int main() {
    int64_t n;
    cin >> n;

    DoublyLinkedList<int64_t> l;
    while (n--) {
        string command;
        int64_t key;
        cin >> command;

        if (command == "insert") {
            cin >> key;
            l.insert_node(key);
        } else if (command == "delete") {
            cin >> key;
            l.delete_node(key);
        } else if (command == "deleteFirst") {
            l.delete_first();
        } else if (command == "deleteLast") {
            l.delete_last();
        }
    }

    l.print();

    return 0;
}

Compiler output:
a.cc:19:11: error: bit-field 'tail' has non-integral type 'DoublyLinkedList<T>::Node*'
   19 |     Node *tail:
      |           ^~~~
a.cc: In member function 'void DoublyLinkedList<T>::insert_node(T)':
a.cc:30:13: error: 'tail' was not declared in this scope
   30 |             tail = head;
      |             ^~~~
a.cc: In member function 'void DoublyLinkedList<T>::delete_node(T)':
a.cc:46:17: error: 'tail' was not declared in this scope
   46 |                 tail = NULL;
      |                 ^~~~
a.cc:60:21: error: 'tail' was not declared in this scope
   60 |                     tail = node->prev;
      |                     ^~~~
a.cc: In member function 'void DoublyLinkedList<T>::delete_last()':
a.cc:95:26: error: 'tail' was not declared in this scope
   95 |         Node *tail_old = tail;
      |                          ^~~~
a.cc: In function 'int main()':
a.cc:128:26: error: 'void DoublyLinkedList<T>::insert_node(T) [with T = long int]' is private within this context
  128 |             l.insert_node(key);
      |             ~~~~~~~~~~~~~^~~~~
a.cc:27:10: note: declared private here
   27 |     void insert_node(T x) {
      |          ^~~~~~~~~~~
a.cc:131:26: error: 'void DoublyLinkedList<T>::delete_node(T) [with T = long int]' is private within this context
  131 |             l.delete_node(key);
      |             ~~~~~~~~~~~~~^~~~~
a.cc:39:10: note: declared private here
   39 |     void delete_node(T x) {
      |          ^~~~~~~~~~~
a.cc:133:27: error: 'void DoublyLinkedList<T>::delete_first() [with T = long int]' is private within this context
  133 |             l.delete_first();
      |             ~~~~~~~~~~~~~~^~
a.cc:78:10: note: declared private here
   78 |     void delete_first() {
      |          ^~~~~~~~~~~~
a.cc:135:26: error: 'void DoublyLinkedList<T>::delete_last() [with T = long int]' is private within this context
  135 |             l.delete_last();
      |             ~~~~~~~~~~~~~^~
a.cc:86:10: note: declared private here
   86 |     void delete_last() {
      |          ^~~~~~~~~~~
a.cc:139:12: error: 'void DoublyLinkedList<T>::print() [with T = long int]' is private within this context
  139 |     l.print();
      |     ~~~~~~~^~
a.cc:103:10: note: declared private here
  103 |     void print() {
      |          ^~~~~