Pass shared pointers by value in add/addListener functions