Fix some linker errors caused by template friends on Mountain Lion.