When I input the value for the string types, for examples:
_hoI typedPeter
_hotenI typedPeter Parker
_tenI typedMarry
My output on the screen was:
PeterPeterMarry
Here is my code:
class SinhVien
{
private:
    string _ho;
    string _tenlot;
    string _ten;
public:
    static int InstanceCount;
    SinhVien();
    string ToString() const;
    friend istream& operator>>(istream& in, SinhVien* p);
    friend ostream& operator<<(ostream& out, const SinhVien* p);
    ~SinhVien();
};
istream& operator>>(istream& in, SinhVien *p)
{
    cout << "Nhap ho: \n";
    in >> p->_ho;
    rewind(stdin);
    cout << "Nhap ten lot: \n";
    in >>  p->_tenlot;
    rewind(stdin);
    cout << "Nhap ten: \n";
    in >> p->_ten;
    return in;
}
string SinhVien::ToString() const
{
    stringstream writer;
    writer << _ho << " " << _tenlot << " " << _ten << "\n";
    return writer.str();
}
ostream& operator<<(ostream &out, const SinhVien* p)
{
    out << p->ToString();
    return out;
}
void main()
{
    SinhVien *a;
    a = new SinhVien();
    cin >> a;
    cout << a;
    cout << "\nTo string:\n";
    cout << a->ToString();
    delete a;
    system("pause");
}
 
    