If you don't mind using OSL (that is, setting the render to Cycles/CPU, and checking the 'OSL' option) then you can look ahead down a ray, using a script.
This script returns the Pass Index of the next material encountered, continuing in the direction of the incoming ray, (so it won't, without improvement, take refractive/reflective deflection into account, and the lens is a single plane, without thickness.)
#include "stdosl.h"
shader NextIdx(
output float nextIdx = 0.0
)
{
if (trace(P,-I,"mindist",0.00001)){
getmessage("trace", "material:index", nextIdx);
}
}
.. and can be used in a tree something like this, to make the 'glass' of the lens:
.. where the eye material has an Pass Index of 10, and everything else has an index of 0...
producing..
so in this example, the 'glass' is transparent to everything has a material Pass Index greater than 5, and diffuse grey to everything else.