Toolbar::addDefaultItems() won't accept my factory

Based on the demo toolbar I tried the following:

Code in private section of GUI.h

juce::Toolbar topToolbar;

class CustomToolbarItemFactory : juce::ToolbarItemFactory {

public:
	CustomToolbarItemFactory() {};

	void getAllToolbarItemIds(juce::Array<int>& ids) override {
		ids.add(1);
	}

	void getDefaultItemSet(juce::Array<int>& ids) override {
		ids.add(1);
	}

	juce::ToolbarItemComponent* createItem(int itemid) override {
		if (itemid == 1)
			return new juce::ToolbarButton(itemid, "", juce::Drawable::createFromImageData(BinaryDataStorage::fit_to_win_png, BinaryDataStorage::fit_to_win_pngSize), 0);
		return 0;
	}

};

CustomToolbarItemFactory factory;

code in GUI constructor (GUI.cpp)

addAndMakeVisible(topToolbar);
topToolbar.addDefaultItems(factory);

But this line: topToolbar.addDefaultItems(factory); gives me this error:

Error: Conversion is inaccessible base class “juce::ToolbarItemFactory” is not allowed. Any idea what’s wrong?

OOOh nevermind just realized I forgot public keyword lol

I changed to:

  class CustomToolbarItemFactory : public juce::ToolbarItemFactory {

but now I get another error:

Error: ‘GUI’: cannot instatiate abstract class

Okay that was another stupid mistake.