How to create a new function within an existing Arduino library?

This is my first time modifying a Arduino library.
I am trying to add a simple function to the Arduino Keyboard library, but get a compile error.
I am probably doing it wrong. My attempt is listed below.

I added function declaration for "getModifiers()"
Arduino\hardware\arduino\cores\arduino\USBAPI.h

class Keyboard_ : public Print
{
private:
	KeyReport _keyReport;
	void sendReport(KeyReport* keys);
public:
	Keyboard_(void);
	void begin(void);
	void end(void);
	virtual size_t write(uint8_t k);
	virtual size_t press(uint8_t k);
	virtual size_t release(uint8_t k);
	virtual void releaseAll(void);
	uint8_t getModifiers();                          //I added this line
};
extern Keyboard_ Keyboard;

I added function definition for "getModifiers()"
Arduino\hardware\arduino\avr\cores\arduino\HID.cpp

uint8_t Keyboard_::getModifiers()
{
	return _keyReport.modifiers;
}

This is the test sketch

void setup()
{
}

void loop()
{
    Keyboard.write("\nKEY_LEFT_SHIFT=");
    Keyboard.write(KEY_LEFT_SHIFT);

    Keyboard.write(" not shifted modifiers=");
    Keyboard.write(Keyboard.getModifiers());

    Keyboard.press(MODIFIER_LEFT_SHIFT);

    Keyboard.write(" shifted modifiers=");
    Keyboard.write(Keyboard.getModifiers());

    while(true) { } 
}

I restarted Arduino IDE and get this compile error:

C:\Program Files (x86)\arduino-1.6.4/hardware/tools/avrteensy/bin/avr-g++ -c -Os -g -Wall -ffunction-sections -fdata-sections -MMD -fno-exceptions -felide-constructors -std=c++0x -mmcu=atmega32u4 -DTEENSYDUINO=123 -DARDUINO=10604 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DUSB_HID -DLAYOUT_US_ENGLISH -IC:\Program Files (x86)\arduino-1.6.4\hardware\teensy\avr\cores\teensy C:\Users\wolf\AppData\Local\Temp\build1030473635684301006.tmp\Keyboard_pressShifted.cpp -o C:\Users\wolf\AppData\Local\Temp\build1030473635684301006.tmp\Keyboard_pressShifted.cpp.o 
Keyboard_pressShifted.ino: In function 'void loop()':
Keyboard_pressShifted.ino:8:34: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Keyboard_pressShifted.ino:11:29: error: 'class usb_keyboard_class' has no member named 'getModifiers'
Keyboard_pressShifted.ino:13:20: error: 'MODIFIER_LEFT_SHIFT' was not declared in this scope
Keyboard_pressShifted.ino:16:29: error: 'class usb_keyboard_class' has no member named 'getModifiers'
'class usb_keyboard_class' has no member named 'getModifiers'

I am running Arduino 1.6.4 and Teensyduino 1.23 for Teensy 2.0.

I read the "How to write libraries for the Arduino?" on Arduino Playground - Library Tutorial

Suggestions are appreciated.

Keyboard_pressShifted.ino:11:29: error: 'class usb_keyboard_class' has no member named 'getModifiers'

That is not referring to your class, for some reason.

i notice that your class has some virtual functions.

you may want to see how the usb kbd class inherits this parent,
maybe your new method is not public to the child?

i suck at c++ but i'd look at inheritance issues like that.

Thanks for the hint Nick.

usb_keyboard_class is declared in arduino-1.6.4\hardware\teensy\avr\cores\usb_hid\usb_api.h
and defined in arduino-1.6.4\hardware\teensy\avr\cores\usb_hid\usb_api.cpp
So I guess that is were the compiler is finding 'class usb_keyboard_class'.

I was trying to access arduino-1.6.4\hardware\arduino\avr\cores\arduino\ files, which is what Arduino hardware uses, but apparently Teensy uses other files.
Since I am compiling for Teensy 2.0, I should post my question at the pjrc forum.

Yes, when you switch to another board different libraries may be used. I'm not sure of the exact mechanism but I think if it finds them in the hardware folder it uses those instead.