title: Boost serialization issue with text archive
body: <p>I have a pretty simple class, that I want to serialize with boost::serialize.</p>
  
  <pre><code>class Entity {      
  private:
      ObjectType objectType;
  public:
      Entity(ObjectType t = tA) { objectType = t; }
  public:
      ~Entity() {}
  private:
        friend class boost::serialization::access;
    template &lt;typename Archive&gt;
    friend void boost::serialization::serialize(Archive&amp; ar, Entity&amp; o, const unsigned int version);
  };
  </code></pre>
  
  <p>}</p>
  
  <p>ObjectType is an enum:</p>
  
  <pre><code>typedef enum ObjectType {
   tA,
   tB,
   ...
   tZ
  }
  </code></pre>
  
  <p>And the serialization function is the following:</p>
  
  <pre><code>template&lt;class Archive&gt;
  void serialize(Archive &amp; ar, Entity &amp; o, const unsigned int version)
  {
        ar &amp; o.objectType;
  }
  </code></pre>
  
  <p>Saving and loading are performed with the following functions:</p>
  
  <pre><code>void saveObject2File(const Entity &amp;o, const char * filename) {
   std::ofstream ofs(filename);
   boost::archive::text_oarchive oa(ofs); 
   oa &amp; o;
  }
  
  Entity * loadObjectFromFile(const char * filename) {
   std::ifstream ifs(filename);
   boost::archive::text_iarchive ia(ifs);
   Object * o;
   ia &amp; o;
   return o;
  }
  </code></pre>
  
  <p>When I serialize to a file, the following text is written into it, where the number 17 is the integer value stored in the objectType variable.</p>
  
  <pre><code>22 serialization::archive 10 0 0 17
  </code></pre>
  
  <p>However, when I read this file, the value 17 is received by the <code>serialize</code> method as the <code>version</code> parameter, and the <code>objectType</code> is assigned with a wrong value <code>(o.objectType = -858993460)</code>.</p>
  
  <p>If I manually change the class version <code>BOOST_CLASS_VERSION(Entity, 111);</code> before saving and loading, I get a runtime-exception. Writing works with the 111 version number, but reading the file fails.</p>
  
  <p>Strangely enough, if I use xml archives, the problem does not occur.
  The problem is the same if I opt to serialize an integer instead of the enum.
  It seems as if the text_iarchive is looking for (and reading) an extra parameter, which is not provided by the text_oarchive, therefore 17 is read as the version number.</p>
  
  <p>I am using Boost 1.55 and Visual Studio 2013.</p>
  
  <p>Any help is welcome.</p>