about variant type

i have my own variant type:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// *** ADDED BY HEADER FIXUP ***
#include <cstdlib>
#include <iostream>
#include <string>
// *** END ***
#ifndef VARIANT_H_INCLUDED
#define VARIANT_H_INCLUDED

class variant
{
    string a="";
 public:

    variant (string value="")
    {
        a=value;
    }

    variant (double value)
    {
        a=to_string(value);
    }

    friend istream& operator >>(istream &is,variant &obj)
    {
        is>>obj.a;
        return is;
    }

    friend ostream& operator <<(ostream &os,const variant &obj)
    {
        os<<obj.a;
        return os;
    }

    friend istream &getline(istream &in, variant &s1)
    {
        getline(in, s1.a);
        return in;
    }


    variant & operator = (int const & b)
    {
        a=to_string(b);
       return *this;
    }

    variant & operator = (string const & b)
    {
        a=b;
        return *this;
    }

    variant & operator = (double const & b)
    {
        a=to_string(b);
        return *this;
    }

    variant & operator = (float const & b)
    {
        a=to_string(b);
        return *this;
    }

    bool operator == (string const & b)
    {

        return  (a==b);
    }

    operator string() const
    {
        return a; // return string member
    }

    operator double() const
    {
        return atof(a.c_str()) ;
    }

};

#endif // VARIANT_H_INCLUDED 

the only problem is that don't accept structs\unions\enums\class's or others. can anyone advice me for accept it?
Topic archived. No new replies allowed.