Older gcc (4.4) does not allow conversion of shared_ptr<Foo> to shared_ptr<const Foo>. Pointed out by @bska.