How about instantiating the Encoder dynamically? This is a modification of the "Basic Example" from the Encoder library. It compiles but is untested:

#include "Arduino.h"
#include <Encoder.h>
...