in the example I see
#include "ESP8266WiFi.h"
this - in the version I have on my PC - includes several depending headers
#include "IPAddress.h"
#include "ESP8266WiFiType.h"
#include "ESP8266WiFiSTA.h"
#include "ESP8266WiFiAP.h"
#include "ESP8266WiFiScan.h"
#include "ESP8266WiFiGeneric.h"
#include "WiFiClient.h"
#include "WiFiServer.h"
#include "WiFiClientSecure.h"
P.S.: I just did a quick copy/paste of the sample code and let it compile ==> no errors.
maybe your arduino / esp8266 installation is quirky. Sometimes updates of arduino (atmel) libraries interfere with esp8266 if the platform type in the lib is not set correctly; looks like updated arduino libs are first in search tree...