If your object is some distance away from your sensor you are going to need an IR sensor. Be aware that at the frequencies IR temperature sensors operate at the IR will not pass through glass.
See here: http://www.moistureview.com/blog-06
I am not aware of any cheap IR sensors like that will operate out to 15 feet.
What are you trying to measure the temperature of? What temperature range is expected?
A better solution might be to put a temperature sensor on the object and transmit the temperature readings back to the Pi wirelessly.
You could use an ESP32 module or some such to create a WIFI or Bluetooth link back to the Pi. If you are taking temperature readings infrequently it could run some time from batteries.
Memory in C++ is a leaky abstraction .