how to fix lnk2019 errors that occur with any methods of the class from .h with the implementation of methods in .cpp?

I have implemented a class of polynomials (and matrices). I checked the performance of all the methods in a separate sandbox project. After that, I split the class into 2 files. .h and .cpp. I tried to use the methods of the class and it turned out that the lnk2019 error occurs in each one. Earlier, I was able to solve a similar error by adding before the class description (inside .h)lines:

template<typename P> class polynomial;
template<typename P> std::ostream& operator<<(std::ostream& out, const polynomial<P>& plnm);
template<typename P> std::istream& operator>> (std::istream& in, polynomial<P>& plnm);

Adding the lines above did not fix the error.

content .h
#include<iostream>
#include <sstream>
template<typename P> class polynomial;
template<typename P> std::ostream& operator<<(std::ostream& out, const polynomial<P>& plnm);
template<typename P> std::istream& operator>> (std::istream& in, polynomial<P>& plnm);

template<typename P> class polynomial
{
public:

    P* ptr;
    uint64_t deg;
    polynomial() :polynomial(0) {};
    polynomial(uint64_t size);
    ~polynomial();
    polynomial<P> operator+(const polynomial<P>& other)const;//addition of polynomials
    polynomial<P> operator-(const polynomial<P>& other)const;
    polynomial<P> operator/(const polynomial<P>& other)const;//binary division of a polynomial by a polynomial
    polynomial<P> operator%(const polynomial<P>& other)const;//the remainder of the division of a polynomial by a polynomial
    polynomial<P> operator*(const polynomial<P>& other)const;//binary polynomial multiplication 
    polynomial<P> operator*(const P& other)const; //binary polynomial multiplication by an element from the field

    friend std::ostream& operator<<<>(std::ostream& out, const polynomial<P>& plnm); // overloading the output operator
    friend std::istream& operator>><>(std::istream& in, polynomial<P>& plnm); // overloading the input operator

    polynomial<P> operator>>(const uint64_t power)const;//coefficient shift (increase). or (plnm*x^n)
    polynomial<P> operator<<(const uint64_t power)const;//coefficient shift(decrease). or the whole part of (plnm* x^(-n))

    //P& operator[](uint64_t index);//the access operator to the polynomial coefficient

    polynomial<P>& operator=(const polynomial<P>& other);

    bool operator==(const polynomial<P>& other)const;// 
    bool operator!=(const polynomial<P>& other)const;
};

content main

int main() {

    polynomial<double> a(2);
    
    std::cin >> a;
    std::cout << "a = n" <<a;

    system("pause");
    return 0;
}

an error occurs with each method, so for brevity, I wrote the simplest option in the main one.

part of the contents of the .cpp file
template<typename P>polynomial<P> polynomial<P>::operator>>(const uint64_t power)const
{
    polynomial result(deg + power);
    for (uint64_t i = 0; i < deg; i++)
    {
        result.ptr[i + power] = ptr[i];
    }
    return result;
}

template<typename P>polynomial<P> polynomial<P>::operator<<(const uint64_t power)const
{
    polynomial result(deg - power);
    for (uint64_t i = 0; i <= (deg - power); i++)
    {
        result.ptr[i] = ptr[i + power];
    }
    return result;
}

I assume that the problem may be related to the fact that the polynomial<T> that I declare in the main is not considered a template. This was the case with the operators >> and <<. But I fixed it with three lines, but the compiler seems to think differently.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật