Добавь сюда статическую функцию, статическую переменную, дружественную переменную, там где это необходимо
#ifndef SELF_ORDERED_ARRAY_H
#define SELF_ORDERED_ARRAY_H

#include <iostream>
#include <stdexcept>

namespace SelfOrderedArray {

    template <class T>
    struct Node {
        T data;
        Node* next;
    };

    template <class T>
    class Array {
    private:
        Node<T>* head;

    public:
        Array() : head(nullptr) {}

        void add(const T& item) {
            Node<T>* newNode = new Node<T>;
            newNode->data = item;
            newNode->next = nullptr;

            if (!head) {
                head = newNode;
            } else {
                if (item < head->data) {
                    newNode->next = head;
                    head = newNode;
                } else {
                    Node<T>* current = head;
                    while (current->next && item > current->next->data) {
                        current = current->next;
                    }
                    newNode->next = current->next;
                    current->next = newNode;
                }
            }
        }

        T& operator[](int index) {
            int count = 0;
            Node<T>* current = head;
            while (current) {
                if (count == index) {
                    return current->data;
                }
                count++;
                current = current->next;
            }
            throw  out_of_range("Index out of range");
        }

        Array<T> operator+(const Array<T>& other) {
            Array<T> result = *this;
            Node<T>* current = other.head;
            while (current) {
                result.add(current->data);
                current = current->next;
            }
            return result;
        }

        Array<T> operator-(const Array<T>& other) {
            Array<T> result = *this;
            Node<T>* current = other.head;
            while (current) {
                try {
                    result.remove(current->data);
                } catch (const  exception& e) {
                     cerr << e.what() <<  endl;
                }
                current = current->next;
            }
            return result;
        }

        // Define other operators and methods for division, slicing, etc.

        void remove(const T& item) {
            if (!head) {
                throw  out_of_range("Array is empty");
            }
            if (head->data == item) {
                Node<T>* temp = head;
                head = head->next;
                delete temp;
                return;
            }
            Node<T>* current = head;
            while (current->next) {
                if (current->next->data == item) {
                    Node<T>* temp = current->next;
                    current->next = current->next->next;
                    delete temp;
                    return;
                }
                current = current->next;
            }
            throw  invalid_argument("Item not found in array");
        }

        void print() {
            Node<T>* current = head;
            while (current) {
                 cout << current->data << " ";
                current = current->next;
            }
             cout <<  endl;
        }

        // Define other methods for division, slicing, etc.

        ~Array() {
            while (head) {
                Node<T>* temp = head;
                head = head->next;
                delete temp;
            }
        }
    };
}
#endif // SELF_ORDERED_ARRAY_H