#include "bar.h" boost::shared_ptr g_foo; void function_that_takes_foo(boost::shared_ptr foo) { g_foo = foo; } boost::shared_ptr function_that_returns_foo() { return g_foo; } int Foo::instance_count = 0;