algorithm – How to implement simple Date class in C++?

I would like to know how can I improve my simple Date class in C++. I am reading https://www.amazon.com/Exceptional-Engineering-Programming-Problems-Solutions/dp/0201615622 and the very first example handle with a Date object, but provide no implementation. So I tried to implement it myself:

Date.hpp:

#ifndef DATE_HPP
#define DATE_HPP

#include <sstream>
#include <time.h>

#define fmt "%m/%d/%y"

class Date
{
    std::stringstream buffer;
    struct tm date;

    template <class T>
    void insertbuf(const T &);
    void inserttime();
    std::string getFromIn(std::istream &);

public:
    //ctors
    Date();
    Date(const char *str);
    Date(const std::string &s);
    Date(std::istream &in);
    Date(const Date &d);

    //operators
    Date &operator=(const Date &rhs);

    //friends
    friend std::istream &operator>>(std::istream &, Date &);

    //general
    const std::string getAll() const;
    int getMonth() const;
    int getDay() const;
    int getYear() const;
    void clear();
};

std::istream &operator>>(std::istream &in, Date &d);
std::ostream &operator<<(std::ostream &out, const Date &d);

#endif //DATE_HPP

and its implementation:
date.cpp:

#include <time.h>
#include "date.hpp"
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <ctype.h>

std::string &ltrim(std::string &s)
{
    s.erase(s.begin(), std::find_if(s.begin(), s.end(),
                                    std::not1(std::ptr_fun<int, int>(std::isspace))));
    return s;
}

std::string &rtrim(std::string &s)
{
    s.erase(std::find_if(s.rbegin(), s.rend(),
                         std::not1(std::ptr_fun<int, int>(std::isspace)))
                .base(),
            s.end());
    return s;
}

std::string &trim(std::string &s)
{
    return ltrim(rtrim(s));
}
////

template <class T>
void Date::insertbuf(const T &val)
{
    if (!buffer.rdbuf()->in_avail())
    {
        buffer << val;
    }
}

void Date::inserttime()
{
    buffer >> std::get_time(&date, fmt);
}

std::string Date::getFromIn(std::istream &in)
{
    std::cout << "Enter date in format (mm/dd/yyyy): ";
    std::string tmp;
    std::getline(in, tmp);
    tmp = trim(tmp);
    return tmp;
}

void Date::clear()
{
    buffer.str("");
    buffer.clear();
}

Date::Date()
{
    time_t now = time(0);
    struct tm *tmp = localtime(&now);
    date = *tmp;
    insertbuf<std::_Put_time<char>>(std::put_time(&date, fmt));
}

Date::Date(const char *str)
{
    insertbuf<const char *>(str);
    inserttime();
}

Date::Date(const std::string &s)
{
    insertbuf<std::string>(s);
    inserttime();
}

Date::Date(std::istream &in)
{
    std::string input = getFromIn(in);
    insertbuf<std::string>(input);
    inserttime();
}

Date::Date(const Date &d)
{
    date = d.date;
    insertbuf<std::string>(d.buffer.str());
    inserttime();
}

Date &Date::operator=(const Date &rhs)
{
    if (&rhs != this)
    {
        clear();
        insertbuf<std::string>(rhs.buffer.str());
        inserttime();
    }
    return *this;
}

const std::string Date::getAll() const
{
    int mon = date.tm_mon + 1;
    int day = date.tm_mday;
    int year = date.tm_year + 1900;
    std::string out = std::string("date: ") + std::to_string(mon) + "/" + std::to_string(day) + "/" + std::to_string(year);
    return out;
}

int Date::getMonth() const
{
    return date.tm_mon + 1;
}

int Date::getDay() const
{
    return date.tm_mday;
}

int Date::getYear() const
{
    return date.tm_year + 1900;
}

std::istream &operator>>(std::istream &in, Date &d)
{
    d.clear();
    std::string tmp = d.getFromIn(in);
    d.insertbuf<std::string>(tmp);
    d.inserttime();
    return in;
}

std::ostream &operator<<(std::ostream &out, const Date &d)
{
    out << d.getAll();
    return out;
}

Can If I use it main.cpp:

#include <sstream>
#include <iostream>
#include <iomanip>
#include <time.h>
#include "date.hpp"
#include <vector>
#include <iterator>
#include <algorithm>

using namespace std;

struct Functor
{
    Functor(const std::string &s) : s_(s) {}
    bool operator()(const Date &d) const
    {
        return d.getAll() == s_;
    }

private:
    const std::string &s_;
};

int main()
{
    vector<Date> e;

    copy(istream_iterator<Date>(cin), istream_iterator<Date>(), back_inserter(e));

    vector<Date>::iterator first = find_if(e.begin(), e.end(), Functor("01/01/2020"));
    vector<Date>::iterator last = find_if(e.begin(), e.end(), Functor("12/31/2020"));

    copy(first, last, ostream_iterator<Date>(cout, "n"));
}

It compiles, it runs. But the problem is it will not output the proper data. If I were to test individual operations such as operator>>, like

Date foo;
std::cin >> foo;

It works correctly. But somehow inside the copy algorithm, which uses istream_iterator and ostream_iterator the information about the date (in struct tm got lost). But otherwise, the class works as expected.