This code has many flaws:
1. The private members should be initialized; otherwise there values are undefined when you instantiate on object of type Student. STL class member variables like 'string', 'vector', etc., do not need to be initialize, because they initialize themselves. But variable like 'int', ''long', etc., should be initialized in the class constructor.
2. How are you supposed to get/set the internal private data? You have not provided public methods for getting or setting those values. You could set their initial values via the constructor. But you would also need public methods for reading them or changing them if required.
Example:
const string& name() { return name; }
void name(const string& aname) { name = aname; }
3. All the I/O should be external methods/functions. The Student class should not know or care were the data it stores is coming from or what it is being used for. There are exceptions to this rule, but that is a more advance subject.
4. You cannot read/write class objects to a file using 'file.read' and file.write' in the manner that you are using. The Student class is not a simple block of memory (or POD) and, therefore, cannot be treated like one. The way you are using them is going to corrupt memory, which is probably what is causing your exception.
5. Do not assume all integer values are of type 'int'. 'sizeof(type)' returns a 'size_t' value, which is implementation defined. It could be an unsigned 32 or 64 bit integer; again it depends on the implementation. This also applies to the file position type. A file position type is defined in the file stream class (Exp.: fstream::pos_type) and is normally of type 'streampos'.
Your compiler should have generated warnings about size type conversion and signed/unsigned comparisons. When you see such warnings, then you should investigate what is causing them. Depending on how your configuration is setup, the compiler may treat such warning as errors instead and refuse to create your program.
(2nd attempt at posting)