Allah (swt) says:
"Then they found one of Our slavesupon whom We had given mercy from Us, 
and We had taught him knowledge from Us." (18:65)
And Moses said unto Khidr:
"Shall I follow you so that you may teach me of what you have been taught 
of right knowledge?' He said: 'Surely, you will not be able to bear with 
me patiently.And how should you bear patiently that which you have never 
encompassed in your knowledge?' He said: 'Allah so wills, you will find me 
patient, and I shall not disobey you in any matter.' He said: 'Then if 
you follow me, question me not on any thing until I myself mention of it 
to you.'' (18:66-70)