TTree as member variable

Dear Rootonians,

we are having a little trouble with some custom object we would like to store to root files. While trying to create a minimum breaking example, we hit the breaking point a little sooner than expected. In short, we want to save the following object to file:

class storage : public TObject
{

  public:

	TTree* tree;

	ClassDef(storage, 1);

};

This seems to work at the beginning. However, when trying to read the object from file, we get a segmentation violation in the streamer:

I’m attaching a small script which (compiled with root) demonstrates the problem. We are using root 5.34.20. Do you have any ideas what we might be doing wrong? Thank you very much in advance for your help!

Regards,
e_dude
breakingExample.C (1.34 KB)

.
breakingExample.C (1.71 KB)

Thank you, that works!